package com.sf.bigscreen.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.sf.bigscreen.model.DayAm;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Select;

import java.util.Date;

/**
 * @Author: bi xuan
 * @Date: 2021/6/24 15:55
 * @Description:
 **/
public interface IDayAmMapper extends BaseMapper<DayAm> {

    /**
     * 删除一段时间的全校的数据
     * @param startDate
     * @param endDate
     * @return
     */
    @Delete("delete from dayam where InfoStyle = \"All\" and TheDay between #{startDate} and #{endDate}")
    Integer deleteDayAmAllInfo(Date startDate, Date endDate);

    /**
     * 删除一段时间的区域数据
     * @param areaId
     * @param startDate
     * @param endDate
     * @return
     */
    @Delete("delete from dayam where InfoStyle =\"Area\" and InfoIndex = #{areaId} and TheDay between #{startDate} and #{endDate}")
    Integer deleteDayAmAreaInfo(Integer areaId,Date startDate,Date endDate);

    /**
     * 删除一段时间的建筑信息
     * @param arcId
     * @param startDate
     * @param endDate
     * @return
     */
    @Delete("delete from dayam where InfoStyle = \"Arc\" and InfoIndex = #{arcId} and TheDay between #{startDate} and #{endDate}")
    Integer deleteDayAmArcInfo(Integer arcId,Date startDate,Date endDate);

    /**
     * 删除一段时间的部门的信息
     * @param departmentId
     * @param startDate
     * @param endDate
     * @return
     */
    @Delete("delete from dayam where InfoStyle = \"Part\" and InfoIndex = #{departmentId} and TheDay between #{startDate} and #{endDate}")
    Integer deleteDayAmDepartmentInfo(Integer departmentId,Date startDate,Date endDate);

    @Delete("delete from dayam where InfoStyle =\"Meter\" and InfoIndex = #{meterId} and TheDay between #{startDate} and #{endDate}")
    Integer deleteDayAmMeterInfo(Integer meterId,Date startDate,Date endDate);
}
